﻿

Public Class HomeControl

    Public Sub New()

        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
        Me.SetStyle(ControlStyles.OptimizedDoubleBuffer Or
                     ControlStyles.UserPaint Or
                     ControlStyles.AllPaintingInWmPaint, True)
    End Sub

    Public Property MainForm As PhDirForm.Form

    Private Sub NewUserButton_Click(sender As System.Object, e As System.EventArgs) Handles NewUserButton.Click
        Me.MainForm.HideAllContentControls()
        Me.MainForm.InsertUser.Visible = True
        Me.MainForm.BackButton.Visible = True
        Me.MainForm.HeadingLabel.Text = Me.NewUserButton.Text
    End Sub

    Private Sub InsertPhoneButton_Click(sender As System.Object, e As System.EventArgs) Handles InsertPhoneButton.Click
        Me.MainForm.HideAllContentControls()
        Me.MainForm.InsertPhone.Visible = True
        Me.MainForm.BackButton.Visible = True
        Me.MainForm.HeadingLabel.Text = Me.InsertPhoneButton.Text
    End Sub

    Private Sub SearchButton_Click(sender As System.Object, e As System.EventArgs) Handles SearchButton.Click
        Me.MainForm.HideAllContentControls()
        Me.MainForm.Search.Visible = True
        Me.MainForm.BackButton.Visible = True
        Me.MainForm.HeadingLabel.Text = Me.SearchButton.Text
    End Sub

    Private Sub TesterButton_Click(sender As System.Object, e As System.EventArgs) Handles TesterButton.Click
        Me.MainForm.HideAllContentControls()
        If Tester.HasLogin Then
            Me.MainForm.TestingControl.Visible = True
            Me.MainForm.HeadingLabel.Text = Me.TesterButton.Text
        Else
            Me.MainForm.TesterLogin.Visible = True
            Me.MainForm.HeadingLabel.Text = "login"
        End If
        Me.MainForm.BackButton.Visible = True
    End Sub

    Private Sub EditNameButton_Click(sender As System.Object, e As System.EventArgs) Handles EditNameButton.Click
        Me.MainForm.HideAllContentControls()
        Me.MainForm.EditName.Visible = True
        Me.MainForm.BackButton.Visible = True
        Me.MainForm.HeadingLabel.Text = Me.EditNameButton.Text
    End Sub

    Private Sub EditPhoneButton_Click(sender As System.Object, e As System.EventArgs) Handles EditPhoneButton.Click
        Me.MainForm.HideAllContentControls()
        Me.MainForm.EditPhone.Visible = True
        Me.MainForm.BackButton.Visible = True
        Me.MainForm.HeadingLabel.Text = Me.EditPhoneButton.Text
    End Sub
End Class
